#include <iostream>
#include <vector>
#include <queue>
using namespace std;

template<typename T>
class BoundedQueue {
public:
    BoundedQueue(size_t maxSize) : maxSize_(maxSize) {}

    void push(const T& value) {
        if (queue_.size() >= maxSize_) {
            std::cerr << "队列已满，无法添加新元素。"<< std::endl;
            return;
        }
        queue_.push(value);
    }

    T pop() {
        if (queue_.empty()) {
            std::cerr << "队列为空，无法弹出元素。"<< std::endl;
            return T();
        }
        T value = queue_.front();
        queue_.pop();
        return value;
    }

    bool empty() const {
        return queue_.empty();
    }

    size_t size() const {
        return queue_.size();
    }

private:
    std::queue<T> queue_;
    size_t maxSize_;
};

int main() {
    BoundedQueue<int> myQueue(3);

    myQueue.push(1);
    myQueue.push(2);
    myQueue.push(3);
    myQueue.push(4); // 队列已满，无法添加新元素。

    std::cout << "队列大小: " << myQueue.size()<< std::endl;

    std::cout << "弹出元素: " << myQueue.pop()<< std::endl;
    std::cout << "弹出元素: " << myQueue.pop()<< std::endl;

    myQueue.push(5);
    myQueue.push(6);

    std::cout << "弹出元素: " << myQueue.pop()<< std::endl;
    std::cout << "弹出元素: " << myQueue.pop()<< std::endl;

    return 0;
}